package gbench.appdemo.medicine.biology.fluid;

import java.util.List;
import java.util.function.Function;

import gbench.appdemo.medicine.chemistry.solution.Solute;
import gbench.appdemo.medicine.chemistry.solution.Solution;
import gbench.appdemo.medicine.chemistry.solution.Solvent;

/**
 * 
 * @author gbench
 *
 */
public class Fluid extends Solution {

    /**
     * 
     * @param solution
     */
    public Fluid(Solution solution) {
        this(solution._1(), solution._2());
    }

    /**
     * 
     * @param solvent
     * @param solutes
     */
    public Fluid(final Solvent solvent, final List<Solute> solutes) {
        super(solvent, solutes);
    }

    /**
     * 
     * @param solutes
     * @return
     */
    public static Function<Solvent, Fluid> builder(Solute... solutes) {
        return solvent -> {
            final var builder = Solution.BUILDER(solutes);
            final var solution = builder.apply(solvent);
            return new Fluid(solution);
        };
    }
    

    /**
     * 生成了液体
     * @param solutes
     * @return
     */
    public static Function<Solvent, Fluid> builder(String... solutes) {
        return solvent -> {
            final var builder = Solution.BUILDER(solutes);
            final var solution = builder.apply(solvent);
            return new Fluid(solution);
        };
    }
    
    /**
     * 
     * @param Solutes
     * @return
     */
    public static Fluid of(final Solute... Solutes) {
        return Fluid.builder(Solutes).apply(Solvent.WATER);
    }
    
    /**
     * 
     * @param Solutes
     * @return
     */
    public static Fluid of(final String... Solutes) {
        return Fluid.builder(Solutes).apply(Solvent.WATER);
    }

}
